{{include file="header.html"}}
{{include file="menu.html"}}
		<!-- 右边侧边栏 -->
		<div class="right">
			<!-- 用户管理部分 -->
			<div class="item">
				<form action="index.php?app=personal" name="myform" method="post" class="ajaxSubmit" onsubmit="return false">
				<!-- 按钮组 -->
				<div class="btn">
					<span class="span_t">用户管理</span>
					<button class="change">修改</button>
					<button class="sure" onClick="check();">确认</button>
					<div class="clear"></div>
				</div>
				<table border="1" class="user_t">
					<tr>
						<td class="one">姓名</td>
						<td class="two"><input type="text" value="{{$result.username}}" name="username"></td>
					</tr>
					<tr>
						<td class="one">邮箱</td>
						<td class="two"><input type="text" value="{{$result.email}}" name="email"></td>
					</tr>
					<tr>
						<td class="one">初始密码</td>
						<td class="two"><input type="password" name="old_password"></td>
					</tr>
					<tr>
						<td class="one">新密码</td>
						<td class="two"><input  type="password" name="new_password"></td>
					</tr>
					<tr>
						<td class="one">确认密码</td>
						<td class="two"><input type="password" name="confirm_password"></td>
					</tr>
				</table>
				</form>
				<p class="warming"></p>
			</div>
		</div>
		<div class="clear"></div>
	</div>
	<script type="text/javascript">
	$(function(){
		$("input").attr("disabled","false").css("border","none");
		$(".change").click(function(){
			$("input").removeAttr("disabled").css("border","1px solid #D8D8D8");
			$(this).hide();
			$(".sure").show()
		})
		// $(".sure").click(function(){
		// 	if($("input[name='old_password']").val()==""){
		// 		$(".warming").html("初始密码不能为空");
		// 		return false;
		// 	}else{
		// 		$(".warming").html("");
		// 	}
		// 	$("input").attr("disabled","false").css("border","none");
		// 	$(this).hide();
		// 	$(".change").show();
		// })
	})

	$("form").keydown(function(e){
		var curkey = e.which; 
		if(curkey == 13){ 
			check();
		}
	}); 

	//登录验证
	function check(){
		var type;
		if({{$smarty.session.member.type}} == '0')
			type = 'student';
		else if({{$smarty.session.member.type}} == '1')
			type = 'teacher';
	    var params = $("form").serialize();
	    $.post('{{"index.php?app=User&act=info"|URL}}',params,function(result){
	        if(result.statusCode=='200'){
	        	ui.success(result.message);
	   			// 点击确认按钮时改变样式
				var url = "{{$smarty.const.__PROJECT__}}Index/"+type; 
				document.location.href = url;//登录后跳转页面
	        }else if(result.statusCode=='300'){
	        	$(".warming").html(result.message);
	        }
	    },'json');
	};
	</script>
</body>
</html>